package thread.demo.stack;

import java.util.Stack;

public class StackTest001 {
  public static void main(String[] args) {
    Stack<Integer> stack = new Stack<>();
    
    System.out.println(stack.push(1));
    System.out.println(stack.push(2));
    System.out.println(stack.push(3));
    
    System.out.println(String.format("通过 peek 拿到栈顶的数据, peek: %s", stack.peek()));
    
    System.out.println(stack.pop());
    System.out.println(stack.pop());
    // 没有数据的话，直接报错
//    System.out.println(stack.pop());
  }
}
